<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
</head>

<body>
    <!-- 
        async await
        让异步代码可以用同步方式编写
        1:去掉.then,在.then前面方法加了一个await
        2.定义一个变量让.then回调方法的返回值=await方法
        3.await方法的最近的父级function前面加一个async
     -->

    <!-- 

        
      -->
    <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
    <script>
        async function getData() {

            axios({
                url: "http://localhost:1337/au/code",
                method: 'post',
                data: {
                    mobile: "13695956584",
                },
            }).then((res) => {
                window.console.log(res);
            }).catch((error) => {

            })

            // window.console.log(123);

            // const res = await axios({
            //     url: "http://localhost:1337/au/code",
            //     method: 'post',
            //     data: {
            //         mobile: "13695956584",
            //     },
            // });
            // window.console.log(res);
            // window.console.log(123);
        }
        getData();
    </script>
</body>

</html>